package com.weseewe.jsp;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
public class HelloController {

    //从 application.properties 中读取配置，如取不到默认值为HelloShanhy

    @Value("${application.hello:Hello Angel}")

    private String hello;


    @RequestMapping("/hello")
    @ResponseBody
    public String hello(Map<String,Object> map){
        System.out.println("HelloController.helloJsp().hello="+hello);
        return"hello";
    }


    @RequestMapping("/index")
    public String helloJsp(Map<String,Object> map){
        System.out.println("HelloController.helloJsp().hello="+hello);
        map.put("hello",hello);
        return"helloJsp";
    }
}
